<meta charset="UTF-8">
<html>
    <?php require_once '/config/config.php'; ?>

    <?php

    class connect_db {

        public $db_connect;

        public function connect() {
            $this->db_connect = mysql_connect(DB_HOST . ":" . DB_PORT, DB_USER, DB_PASS) or die(mysql_error());
            mysql_select_db(DB_NAME, $this->db_connect);
            return $this->db_connect;
        }

        public function query($query) {
            mysql_query('SET NAMES utf8', $this->db_connect);
            $data = mysql_query($query, $this->db_connect);
            $rows = array();
            while ($row = mysql_fetch_assoc($data)) {
                $rows[] = $row;
            }
            return $rows;
        }

        public function select() {
            $this->connect();
            $query = "SELECT * FROM keywords WHERE LENGTH(name) > 10";
            $keywords = $this->query($query);
            return $keywords;
        }

        public function select1() {
            $this->connect();
            $query = "SELECT * FROM works LIMIT 0,10 ";
            $works = $this->query($query);
            return $works;
        }

    }

    